package laundry.ws;

import java.util.ArrayList;
import java.util.Date;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;

import com.laundry.lib.FreeSlot;
import com.laundry.lib.Reservation;
import com.laundry.tables.Booking;


@Path("/book")
public class BookWS {
	
	@GET
	@Path("/bookslot")	
	@Produces("application/json")
	public WSResponse bookASlot(@QueryParam("dt") Date date,@QueryParam("slot") int slot,@QueryParam("emp") String employeeId){
		WSResponse response=new WSResponse();
		Booking booking=Booking.instantiate();	
		if(date!=null)
			response.id=booking.bookASlot(date, slot, employeeId);
		return    response;
		
	}
	
	@GET	
	@Path("/free")
	@Produces("application/json")	
	public  ArrayList<FreeSlot> getFreeSlots(@QueryParam("when") Date date) {
		Booking booking=Booking.instantiate();			
		
		return booking.getFreeSlots(date);
	}
	
	@GET
	@Path("/bookings")
	@Produces("application/json")
	 public ArrayList<Reservation> getMyBookings(@QueryParam("eId") String employeeId){
		
		for(int i=0;i<100000;i++){
			
		}
		 Booking booking=Booking.instantiate();			
			
			return booking.getMyBookings(employeeId);
	 }
	
	
}

